<template>
   <div class="text">
        <h1 v-if="newdata" class="title">{{newdata.title}}</h1>
        <div v-if="newdata" class="article-info"> 类型：{{newdata.type}} 时间：{{newdata.addTime}}</div>
        <p v-if="newdata" class="content">
            {{newdata.content}}
        </p>
    </div>
</template>

<script >
export default {
    data(){
        return{
            newdata:null,
        }
    },
    created:async function(){
        let id = this.$route.params.id

        let {data} = await this.$http.get('/api/getone?id='+id);
        this.newdata=data[0]
        console.log(this.newdata);
    }
}
</script>

<style scoped>
.text{
    width: 640px;
    margin: 0 auto;
}
.article-info{
    color:#999;
    font-size: 14px;
}
p{
    font-size: 16px;
    line-height: 30px;
}
</style>